#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_clicked()
{
    int iTitleBarHeight = style()->pixelMetric(QStyle::PM_TitleBarHeight);
    int x=ui->pushButton->x()+this->x()+ui->pushButton->width()/2;
    int y=ui->pushButton->y()+this->y()+ui->pushButton->height()/2+iTitleBarHeight;
    int w=this->width();
    int h=this->height();

    double rx=1.0*(ui->pushButton->x()+ui->pushButton->width()/2)/w;
    double ry=1.0*(ui->pushButton->y()+ui->pushButton->height()/2)/h;
//    subw.init_place(x,y,rx,ry);
//    subw.start_show();
    subw1.show_animation(x,y,rx,ry);
}

void MainWindow::on_pushButton_2_clicked()
{
    subw1.close_animation();
}
